package cn.hh.hrm.doc;


import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * 针对于  Employee 表的文档映射
 * indexName：索引库
 * type：类型(表类型)
 */
@Document(indexName = "hrm" , type = "employee")
public class EmployeeDoc {

    //对应文档的id  PUT  /index/type/id
    @Id
    private Long id;

    @Field(type = FieldType.Keyword)    //指定为 不分词
    private String userName;

    private int age;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String intro;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    @Override
    public String toString() {
        return "EmployeeDoc{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", age=" + age +
                ", intro='" + intro + '\'' +
                '}';
    }
}